package com.bestcem.xm.om.enums;

import cn.hutool.core.util.StrUtil;
import lombok.Getter;
import lombok.ToString;

/**
 * 模板状态
 *
 * @author zhangfeng <feng.zhang@idiaoyan.com>
 * @version v1.0
 * @date 2021/11/8 16:53
 */
@Getter
@ToString
public enum TemplateStatusEnum {
    /**
     * 页面下拉框可选模板
     */
    NEW("新模板", 0),
    /**
     * 模板修改后，原模板变为此状态
     */
    OLD("旧模板", 1);

    private final String name;

    private final int index;

    TemplateStatusEnum(String name, int index) {
        this.name = name;
        this.index = index;
    }

    public static String getNameByIndex(int index) {
        for (TemplateStatusEnum channel : values()) {
            if (index == channel.getIndex()) {
                return channel.getName();
            }
        }
        return StrUtil.EMPTY;
    }
}
